﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html class="x-admin-sm">
<head>
    <meta name="viewport" content="width=device-width" />
    <meta charset="UTF-8">
    <title>维修价格信息添加</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/Content/X-admin/css/font.css" rel="stylesheet" />
    <link href="~/Content/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/Content/X-admin/js/jquery.min.js"></script>
    <script src="~/Content/X-admin/js/xadmin.js"></script>
    <script src="~/Content/Scripts/System/systemFrame.js"></script>
    <script src="~/Content/Scripts/layui/layui.js"></script>
    <link href="~/Content/Scripts/layui/css/layui.css" rel="stylesheet" />
</head>
<body>
    <span style="margin-top:15px;margin-left:15px">
        <xblock>
            <button class="layui-btn layui-btn-normal" onclick="saveData()"><i class="layui-icon"></i>保存</button>
            <button class="layui-btn layui-btn-normal" onclick="closeWin()"><i class="layui-icon"></i>取消</button>
        </xblock>
    </span>

    <div style="margin: 20px; border: 1px solid #dbdbdb;padding:15px">

        <form id="AddForm">

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    选择大类
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="cNames" name="cNames" autocomplete="off" onclick="openClass()" class="layui-input" style="width:450px">
                    <input type="hidden" id="cCodes" name="cCodes">
                </div>

            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    选择存货
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="proNames" name="proNames" required="" autocomplete="off" class="layui-input" style="width:450px" onclick="openProduct()">
                    <input type="hidden" id="proCodes" name="proCodes">
                </div>
            </div>

            <div class="layui-form-item">

                <label for="L_email" class="layui-form-label">
                    维修价格
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="value" name="value" required="" autocomplete="off" class="layui-input" style="width:250px">

                </div>
                <label for="L_email" class="layui-form-label">
                    元
                </label>
            </div>

        </form>

    </div>
</body>
</html>
<script type="text/javascript">
    function openClass() {
        InfoOpenPage("../Common/selectProductType?isSingle=0", "存货大类选择", "85%", "90%");
    }
    /**
    选择产品存货
    **/
    function openProduct() {
        var value = $("#cCodes").val();
        if (value == "") {
            layer.msg("请先选择存货大类"); return;
        }
        if (value.indexOf(",") >= 0) {
            layer.msg("您选择的存货大类太多了"); return;
        } else {
            InfoOpenPage("../Common/selectProduct?isSingle=0&typeCode="+value, "存货选择", "85%", "90%");
        }
    }
    layui.use(['laydate'], function () {
        var $ = layui.$;
        var laydate = layui.laydate;
        var nowTime = new Date().valueOf();
        var max = null;
        var start = laydate.render({
            elem: '#validDate',
            trigger: 'click',
            type: 'datetime',
            format: 'yyyy/MM/dd',
            btns: ['clear', 'confirm'],
            done: function (value, date) {

            }
        });

    })
    /**

    **/
    function saveData() {
        $.ajax({
            url: "../Basis/saveRepairPrice",
            data: { datas: JSON.stringify(FormToJson("AddForm")) },
            dataType: "json",
            type: "POST",
            success: function (data) {
                if (data.Result) {
                    layer.alert("保存成功", { icon: 6 }, function () {
                        // 获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                    });
                } else {
                    layer.msg(data.Message);
                }
            }
        });
    }
</script>